#include "opencv_scale.h"

#include<opencv2\opencv.hpp>   
#include<opencv2\highgui\highgui.hpp>

using namespace std;
using namespace cv;

void doOpencvScale1()
{
	Mat img = imread("test.jpg");
	imshow("src", img);

	//Mat dst = Mat::zeros(512, 512, CV_8UC3); //我要转化为512*512大小的
	//resize(img, dst, dst.size());
	//imshow("resize", dst);

	Mat dst1;
	resize(img, dst1, Size(), 0.5, 0.5, INTER_AREA);//我长宽都变为原来的0.5倍
	imshow("resize_0.5", dst1);


	Mat dst2;
	resize(img, dst2, Size(), 2.0, 2.0, INTER_LANCZOS4);//我长宽都变为原来的2倍
	imshow("resize_2.0", dst2);


	waitKey(0);

}




void doOpencvScale2()
{
	Mat img = imread("test.jpg");
	imshow("src", img);

	Mat dst, dst2;
	pyrUp(img, dst, Size(img.cols * 2, img.rows * 2)); //放大一倍
	pyrDown(img, dst2, Size(img.cols * 0.5, img.rows * 0.5)); //缩小为原来的一半
	imshow("pyrUp", dst);
	imshow("pyrDown", dst2);

	waitKey(0);

}

